-------------------------
local MaxZombies = 15
local MaxFastZombies = 10
local MaxAntlions = 10
local MaxHeadcrabs = 10
-------------------------
local ZombieSpawnTime = 10
local FastZombieSpawnTime = 15
local AntlionSpawnTime = 15
local AntlionGSpawnTime = 120
local HeadcrabSpawnTime = 5
-------------------------

function Zombies()
    if ( SERVER ) && table.Count(ents.FindByClass("npc_zombie")) < MaxZombies then
        local zombiex = math.Rand(13469, -13119)
        local zombiey = math.Rand(13541, -13037)
        local zombiez = -10730.2
        local zombie = ents.Create("npc_zombie")
        zombie:SetPos(Vector(zombiex, zombiey, zombiez))
        zombie:Spawn()
        zombie:SetColor(255,255,255,255)
        zombie:SetHealth(1000)
    end
end

function FastZombies()
    if ( SERVER ) && table.Count(ents.FindByClass("npc_fastzombie")) < MaxFastZombies then
        local Fastzombiex = math.Rand(13469, -13119)
        local Fastzombiey = math.Rand(13541, -13037)
        local zFastombiez = -10730.2
        local Fastzombie = ents.Create("npc_fastzombie")
        Fastzombie:SetPos(Vector(Fastzombiex, Fastzombiey, Fastzombiez))
        Fastzombie:Spawn()
        Fastzombie:SetColor(255,255,255,255)
        Fastzombie:SetHealth(700)
    end
end

function Antlions()
    if ( SERVER ) && table.Count(ents.FindByClass("npc_antlion")) < MaxAntlions then
        local antlionx = math.Rand(13469, -13119)
        local antliony = math.Rand(13541, -13037)
        local antlionz = -10730.2
        local antlion = ents.Create("npc_antlion")
        antlion:SetPos(Vector(antlionx, antliony, antlionz))
        antlion:Spawn()
        antlion:SetColor(255,255,255,255)
        antlion:SetHealth(1200)
    end
end

function AntlionGuard()
    if ( SERVER ) && table.Count(ents.FindByClass("npc_antlionguard")) < 1 then
        local antlionGuard = ents.Create("npc_antlionguard")
        antlionGuard:SetPos(Vector(-3154.7476, 8065.5264, -12424.9434))
        antlionGuard:Spawn()
        antlionGuard:SetColor(255,255,255,255)
        antlionGuard:SetHealth(6500)
    end
end

function Headcrabs()
    if ( SERVER ) && table.Count(ents.FindByClass("npc_headcrab_fast")) < MaxHeadcrabs then
        local headcrabx = math.Rand(13469, -13119)
        local headcraby = math.Rand(13541, -13037)
        local headcrabz = -10730.2
        local headcrab = ents.Create("npc_headcrab_fast")
        headcrab:SetPos(Vector(headcrabx, headcraby, headcrabz))
        headcrab:Spawn()
        headcrab:SetColor(255,255,255,255)
        headcrab:SetHealth(200)
    end
end

timer.Create("Zombies", ZombieSpawnTime, 0, Zombies)
timer.Create("FastZombies", FastZombieSpawnTime, 0, FastZombies)
timer.Create("Antlions", AntlionSpawnTime, 0, Antlions)
timer.Create("AntlionGuard", AntlionGSpawnTime, 0, AntlionGuard)
timer.Create("Headcrabs", HeadcrabSpawnTime, 0, Headcrabs)



